#include <stdio.h>
#include <stdlib.h>

int compare(const void*a,const void*b)
{
	return *(int*)a - *(int*)b;
}
int main ()
{
	int arr[1001] = {0};
	int n = 0;
	int i = 0;
	scanf("%d",&n);
	while(i<n)
	{
		scanf("%d",&arr[i]);
		i++;		
	}
	qsort(arr,n,sizeof(arr[0]),compare);
	printf("%d",(arr[n-1] - arr[0]));
	
	return 0; 
}
